1. Field of the Invention
The present invention relates to a color image processing apparatus and a pattern extracting apparatus, in particular, to those suitable for extracting a title or the like from a color image.
2. Description of the Related Art
In recent years, as computers and their peripheral units such as printers have become common and their costs have been decreased, color images have been used in a variety of fields. Thus, a technology for dividing a color image into several areas and extracting only a particular area has been desired. For example, a technology for extracting areas with the same color from a color image has been desired. When a color scenery image photographed by a CCD camera is used for an input image to be process, such a technology has been widely desired in many applications for selecting fruit and watching cars and people for securities.
When a color document image is used as an input image, such a technology is expected to automatically extract a document name and a keyword from the image. Examples of such a technology are data retrieval systems such as book categorizing systems in libraries and automatic management systems. In addition, such a technology is used for automatically assigning keywords and file names in groupware for storing and sharing image data as a database. Such information can be used for retrieving desired data from a large number of color document images.
As technologies for extracting a particular area from a color image, the following methods have been proposed.
(1) RGB Color Space Clustering Method
In the RGB color space clustering method, a color separated image is generated. In other words, pixels of an RGB image photographed by a CCD camera are clustered in the RGB space. With pixels in one cluster, an image of each color is generated. Thus, areas with the same color are extracted. Areas generated in such a method are combined so as to extract a new area.
FIG. 1 is a schematic diagram for explaining the conventional RGB color space clustering method.
In FIG. 1, assuming that a color document image 501 is input, patterns with similar colors are extracted and clustered. For example, assuming that patterns 502 and 507 are blue group colors, a pattern 503 is a green group color, and patterns 504 to 506 are red group colors, a cluster 508 that includes the blue group color patterns 502 and 507, a cluster 509 that includes the green group color pattern 503, and a cluster 510 that includes the red group color patterns 504 to 506 are generated in the RGB space.
When the clusters 508 to 510 are generated, images of the clusters 508 to 510 are generated with pixels that are included therein. Thus, for the cluster 508, a color separated image 501a composed of patterns 502′ and 507′ is generated. For the cluster 509, a color separated image 501b composed of a pattern 503′ is generated. For the cluster 510, a color separated image 501c composed of patterns 504′ to 506′ is generated.
(2) Non-RGB Color Space Clustering Method
All pixels of an RGB image represented in the RGB space are converted into another color space such as HSV. The pixels are clustered in the color space in a particular manner. Images are generated with pixels that are included in each cluster so as to extract areas with the same colors. The obtained areas are combined so as to extract a new area.
The following technical papers that describe technologies for extracting character areas from color document images are known.                Senda et. al., “Method for extracting a character pattern from a color image due to a single color of characters (translated title)”, The Institute of Electronics, Information and Communication Engineers, Japan, PRU 94-04, pp 17-24,        Uehane et. al., “Extracting a character area from a color image using iso-color line process (translated title)”, The Institute of Electronics, Information and Communication Engineers, Japan, PRU 94-09, pp 9-16,        Matsuo et. al., “Extracting a single color character area from a color document image (translated title)”, 1997 Annual Convention, The Institute of Electronics, Information and Communication Engineers, Japan, D-12-19,        Matsuo et. al., “Extracting a character string from a scenery image with gradation and color information (translated title)”, The Institute of Electronics, Information and Communication Engineers, Japan, PRU 92-121, pp 25-32.        
(3) Area Expanding Method
In the area expanding method, adjacent pixels are assigned labels corresponding to only similarities of colors. In other words, the maximum value (max) of each color element of (R, G, B) of pixels represented with RGB is obtained and normalized as (R/max, G/max, B/max). Thus, a normalized image is generated.
FIG. 2 is a schematic diagram showing the conventional area expanding method.
In FIG. 2, pixels P1, P2, and so forth in an image are represented with color elements RGB as P1(R1, G1, B), P2(R2, G2, B2), and so forth [1].
Next, the maximum value of each color element is obtained. For example, the maximum value of R1, G1, and B1 of a pixel P1 is denoted by max1. Likewise, the maximum value of R2, G2, and B2 of a pixel P2 is denoted by max2. With the maximum values, each color element is normalized. Thus, normalized pixels P1′(R1/max1, G1/max1, B1/max1) and P2′(R2/max2, G2/max2, B2/max2) are obtained [2].
The square of the difference of each color element of the normalized pixels P1′ and P2′ is obtained. The results are cumulated so as to obtain the distance between the adjacent pixels P1′ and P2′ as d=(R1/max1−R2/max2)2+(G1/max1−G2/max2)2+(B1/max1−B2/max2)2[3].
Thus, when the distance d is smaller than a predetermined fixed threshold value TH0, the pixels P1 and P2 are treated as those with the same color and assigned the same label. After all the image is assigned labels, the same color areas with the same labels are extracted.
In the area expanding method, since only adjacent pixels are processed, the process time of this method is shorter than that of the RGB color space clustering method.
For details of the area expanding method, refer to Japanese Patent Laid-Open Publication No. 5-298443.
In addition, as a method for extracting a character area from a color separated image, the above-mentioned method (by Uehane et. al, “Extracting a character area from a color image using iso-color line process”, The Institute of Electronics, Information and Communication Engineers, Japan, PRU 94-09, pp 9-16) is known. In this method, a character area is extracted from a color image with the following steps.                Enclosing rectangles in connected areas are obtained from a single-color separated image.        Enclosing rectangles are limited in a predetermined range of the sizes and shapes thereof.        An adjacent rectangle search range of each rectangle is assigned. Rectangles are searched as a group in each search range.        Rectangles with a high linearity of center of gravity are kept in each group.        An enclosing rectangle of each group is obtained and a pattern with a color similar to a color of the area that composed the group is extracted.        
However, the conventional clustering method for clustering the same color area of a color image has the following problems.
In the RGB color space clustering method or another color space clustering method (for example, HSV space clustering method), all pixels of the image are clustered. Thus, even if the color of the pattern 502 is different from the color of the pattern 507, when their colors are similar to each other, the patterns 502 and 507 may be categorized as the same cluster 508. In this case, due to the color of the pattern 507, the shape of the cluster of the color of the pattern 502 is varied. Thus, the color range of the cluster of the color of the pattern 502 is distorted. Consequently, the pattern 502 cannot be accurately extracted. For example, when the pattern 502 to be extracted is apart from the pattern 507 with a similar color thereto, if they are extracted as one cluster 508, the color of the cluster 508 becomes a mixed color of the color of the pattern 502 and the color of the pattern 507. The color of the cluster 508 cannot cover the color range of the pattern 502 and the color range of the pattern 508. Thus, holes 511 and 512 may take place in the patterns 502′ and 507′ as the extracted results. Alternatively, contours of the patterns 502′ and 507′ may not be clearly extracted.
In the RGB color space clustering method or another color space clustering method (for example, HSV color space clustering method), since many pixels of all the image are clustered, the calculating time for the clustering process becomes long.
On the other hand, in the area expanding method, to normalize pixels as shown in FIG. 2, since divisions should be performed for each pixel, the number of calculations becomes large. The results of the divisions should be stored as floating-point data for all the pixels. Thus, the memory resource necessary for the process becomes large. Moreover, after the pixels are normalized, adjacent pixels that are equally viewed by the observer may largely deviate from a fixed threshold value depending on the definition of similarities of colors of these pixels. Thus, holes may take place in an area. Alternatively, the contour of an area may not be correctly extracted. In addition, since only the relation of adjacent pixels is considered, when the color gradually varies at the boundary of the character area and the background area, the character area and the background area are assigned the same label.
In the conventional character area extracting method, color separated images are generated corresponding to the number of colors of the entire image. Thus, it takes a long time to generate the color separated images. For example, when a title is extracted from the image, the title tends to be adversely affected by other colors. Thus, the extracting accuracy of the title deteriorates. When an enclosing rectangle of connected areas is obtained, the entire image should be processed for each of the extracted color separated images. Consequently, a plurality of images with the same size (corresponding to the number of extracted colors) are required for a color image. Thus, it takes a long time to process the color image.
In addition, since enclosing rectangles are grouped corresponding to the individual color separated images of the entire color image, it takes a long time to process the color image. When characters to be extracted are clustered to different color separated images, they cannot be properly extracted.
When patterns are grouped, only rectangles in relevant search ranges are extracted. Thus, small portions tend to be dropped from relevant groups. To restore dropped portions, patterns with similar colors are extracted at last. However, at this point, noise with a similar color tends to be extracted.